import {fromJS} from 'immutable'
import {RECEIVE_CATEGORY_DATA,RECEIVE_DATA_BY_CATEGORY} from '../../../store/actionTypes'
//使用immutable来防止state数据被改变，
const defaultState = fromJS({
    CategoryList:[],
    CateContentList:[],
});
export default (state = defaultState,action) =>{
    if(action.type === RECEIVE_CATEGORY_DATA){
        return state.set('CategoryList',action.data);
    }
    if(action.type === RECEIVE_DATA_BY_CATEGORY){
        return state.set('CateContentList',action.data);
    }
    return state;
}